/*
 * xyos/trunk/src/process_control/fork.c
 *
 * Harry Wei <harryxiyou@gmail.com> 2011 (C)
 */

#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <glib.h>
#include <stdlib.h>

uint32_t xyos_fork(void)
{
	pid_t pid;

	while (1) {
		if (0 > (pid = fork())) {
			g_message("%s -- fork error!\n", __func__);
			return -1;
		} else if (0 == pid) {
			g_message("%s -- this is child process, my pid is %d ...\n", __func__, getpid());
		} else {
			g_message("%s -- this is father process, my pid is %d ... \n", __func__, getppid());
		}
	}
	return 0;
}
